#! /usr/bin/env python
# -*- coding: utf-8 -*-


class Solution:
    def strStr(self, source, target):
        if source is None or target is None:
            return -1

        if source == '' and target == '':
            return 0

        src_len = len(source)
        tar_len = len(target)

        for i in range(src_len):
            if src_len - i < tar_len:
                return -1

            if self.is_match(source, i, target, tar_len):
                return i

        return -1

    def is_match(self, src, idx, target, tar_len):
        return src[idx:idx+tar_len] == target


def main():
    print("start main")

    s = Solution()
    r = s.strStr('', '')
    # r = s.strStr('asdf', 'sd')
    # r = s.strStr('asdf', 'df')
    print(r)

if __name__ == "__main__":
    main()
